﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="apple-touch-fullscreen" content="yes">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no">
	<title>素材</title>

	 <link rel="stylesheet" type="text/css" href="./css/uploadbutton.css">
	<script type="text/javascript" src="./js/uploadbutton.js"></script>
	<script src="../ace/assets/js/jquery-1.10.2.min.js"></script>
	<!--<script type="text/javascript" src="./js/bootstrap.min.js"></script>-->
	<!--<link rel="stylesheet" href="./css/bootstrap.min.css">-->
	<!--<script type="text/javascript" src="./js/up.js"></script>-->
	<link rel="stylesheet" type="text/css" href="./css/base.css">
	<link rel="stylesheet" type="text/css" href="./css/home.css">

</head>
<body>
<section class="aui-content">
	<div style="height:20px;"></div>
	<div class="aui-content-up">
		<form action="" name="form1" method="post" >
			<div class="aui-content-up-form">
				<h2>新增工单</h2>
			</div>
			<div class="row" style="padding-top:20px">
				<div class="col-md-3">
					<table  id="tasktypetable" class="table table-bordered table-hover">
						<thead>
							<tr>
								<th id="taskhead">任务类别</th>
							</tr>
						</thead>
						<tbody>
							<tr><td id="task1">2017年网公司党组巡视</td></tr>
							<tr><td id="task2">2018年省公司对茂名供电局“机动式”巡察</td></tr>
							<tr><td id="task3">五个专项治理、五个专项行动</td></tr>
							<tr><td id="task4">其它巡视巡察</td></tr>
							<tr><td id="task5">扫雷行动</td></tr>
							<tr><td id="task6">红包专项治理</td></tr>
							<tr><td id="task7">正风反腐三年行动</td></tr>
							<tr><td id="task8">形式主义、官僚主义专项治理</td></tr>
						</tbody>
					</table>
				</div>
				<div class="col-md-3">
					<table class="table table-bordered table-hover" >
						<thead>
							<tr>
								<th>对照事项</th>
							</tr>
						</thead>
						<tbody>
								<tr><td>对照事项1</td></tr>
								<tr><td>对照事项2</td></tr>
								<tr><td>对照事项3</td></tr>
								<tr><td>对照事项4</td></tr>
								<tr><td>对照事项5</td></tr>
								<tr><td>对照事项6</td></tr>
								<tr><td>对照事项7</td></tr>
								<tr><td>对照事项8</td></tr>
						</tbody>
					</table>
				</div>
				<div class="col-md-1">
					<div style="padding-top:5px">
						<button class="btn btn-primary" >添加</button>
					</div>
					<div style="padding-top:5px">
						<button class="btn btn-primary" >取消</button>
					</div>
				</div>
				<div class="col-md-4">
						<table class="table table-bordered table-hover" >
							<thead>
								<tr>
									<th>选择</th>
								</tr>
							</thead>
							<tbody>
								<tr><td>2017年网公司党组巡视->对照事项1</td></tr>
								<tr><td>2017年网公司党组巡视->对照事项3</td></tr>
								<tr><td>五个专项治理、五个专项行动->对照事项2</td></tr>
							</tbody>
						</table>
					</div>
			</div>
			<div class="row" style="padding-top:10px">
				<div class="col-md-6">
					<label>
						自查发现问题
					</label>
					<textarea  class="form-control" id="selfcheckproblem" style="height: 90px;resize:none"></textarea>
				</div>
				<div class="col-md-6">
						<label>
							落实整改措施
						</label>
						<textarea  class="form-control" id="measures" style="height: 90px;resize:none"></textarea>
					</div>
			</div>
			<div class="row" style="padding-top:10px">
				<div class="col-md-6">
					<label>
						落实完成情况
					</label>
					<textarea  class="form-control" id="finish_result" style="height: 90px;resize:none"></textarea>
				</div>
				<div class="col-md-6">
						<label>
							运用“四种情况”工作情况
						</label>
						<textarea  class="form-control" id="fourforms" style="height: 90px;resize:none"></textarea>
					</div>
			</div>
			<div class="row" style="padding-top:10px">
				<div class="col-md-6">
					<label>
						与纪律教育月结合情况
					</label>
					<textarea  class="form-control" id="diseducation" style="height: 90px;resize:none"></textarea>
				</div>
			</div>
			<div class="row" style="padding-top:10px">
				<div class="col-md-6">
					<div class="uploader white">
						<input type="text" class="filename" id="filenameinput" readonly="readonly"/>
						<input type="button" name="file" class="button" value="支撑材料"/>
						<input type="file" size="30"/>
					</div>
				</div>
			</div>
			<div class="row" style="padding-top:10px">
				<div class="col-md-12">
					<div class="aui-btn-default">
						<button class="aui-btn aui-btn-account" id="update_workoder" onclick="uploadworkorder()">保存并提交工单</button>
					</div>
				</div>
			</div>
		</form>
	</div>

</section>
<!-- mask begin -->
<div class="aui-mask aui-works-mask">
	<div class="aui-mask-content">
		<p class="aui-delete-text">确定要删除你上传的资料？</p>
		<p class="aui-check-text">
			<span class="aui-delete aui-accept-ok">确定</span>
			<span class="aui-accept-no">取消</span>
		</p>
	</div>
</div>
<!-- mask end -->



<script type="text/javascript">

    var userId = 1;//此变量存储当前登录用户的userId，以便赋予对应用户权限
    var workMattersIndex = 1;//此变量存储工作事项标记（按找要求一共有46项工作事项，以0-45标记各项）

    //验证姓名
    function checkna(){

        na=form1.yourname.value;

        if( na.length <1 || na.length >6)
        {
            divname.innerHTML='<font class="tips_false">长度是1~6个字符</font>';
        }else{
            divname.innerHTML='<font class="tips_true">输入正确</font>';
        }
    }
    //验证手机号码
    function checkpsd1(){

        na=form1.youphone.value;

        if( na.length <11 || na.length >11)

        {

            phone.innerHTML='<font class="tips_false">必须是11位的数字</font>';



        }else{

            phone.innerHTML='<font class="tips_true">输入正确</font>';



        }



    }
    //验证社会统一代码
    function checkpsd2(){

        na=form1.youziz.value;

        if( na.length <18 || na.length >18)

        {

            zizhi.innerHTML='<font class="tips_false">必须是18位社会信用代码</font>';



        }else{

            zizhi.innerHTML='<font class="tips_true">输入正确</font>';



        }



    }
    //上传工单
    function uploadworkorder(){
        var tasktypeid = document.getElementById("tasktype").selectedIndex;
        var tasktypeoptions = document.getElementById("tasktype").options;
        var dzsxid = document.getElementById("dzsx").selectedIndex;
        var dzsxoptions = document.getElementById("dzsx").options;
        var selfcheckproblemtext = document.getElementById("selfcheckproblem").value;
        var measurestext = document.getElementById("measures").value;
        var finish_resulttext = document.getElementById("finish_result").value;
        var fourformstext = document.getElementById("fourforms").value;
        var diseducationtext = document.getElementById("diseducation").value;
        var zrlytext = document.getElementById("zrly").value;
        var zrrtext = document.getElementById("zrr").value;
        var zrbmtext = document.getElementById("zrbm").value;
        var contactinformationtext = document.getElementById("contactinformation").value;
        alert(tasktypeoptions[tasktypeid].text +
            " 对照事项：" +
            dzsxoptions[dzsxid].text +
            "自查问题" +
            selfcheckproblemtext +
            " 落实措施：" +
            measurestext +
            finish_resulttext +
            fourformstext +
            diseducationtext +
            zrlytext +
            zrbmtext +
            contactinformationtext
        );
        $.ajax(
            {
                type:"POST",
                url:"",
                dataType: "json",
                async: false,
                data:{

                },
            }
        )
    };

    function addOptionToDzsx(data) {
        if (data.length == 0) {
            //理论上是不可能发生的，因为八大领域每个领域都一定会有对照事项
            alert('The result is empty!');
        } else {
            var dzsx = document.getElementById('dzsx');
            dzsx.innerHTML = null;
            for (var i = 0; i <= data.length; i++) {
               var dzsxOption = document.createElement('option');
               dzsxOption.innerHTML = data[i].compareItem;
               dzsx.appendChild(dzsxOption);
           }
        }
    }

    //页面加载出来的时候先将对照事项的选项菜单填好，否则八大领域选项菜单的默认项不会触发onchange事件
    function loadDzsxOption() {
        var tasktypeid = document.getElementById("tasktype").selectedIndex;
        var eightfieldsindex = tasktypeid + 1;
        $.ajax(
            {
                type:"POST",
                url:"http://localhost:8080/mm-ssm/eightfield/all",
                dataType: "json",
                data:{
                    eightFieldsIndex: eightfieldsindex,
                    workMattersId: workMattersIndex
                },
                success: function (data) {
                    addOptionToDzsx(data);
                },
                error: function (error) {
                    alert("Request error!" + error);
                }
            }
        )
	}

    $(function () {
        loadDzsxOption();
        $('#tasktype').on('change', function () {
            var tasktypeid = document.getElementById("tasktype").selectedIndex;
            var eightfieldsindex = tasktypeid + 1;
            $.ajax(
                {
                    type:"POST",
                    url:"http://localhost:8080/mm-ssm/eightfield/all",
                    dataType: "json",
                    data:{
                        eightFieldsIndex: eightfieldsindex,
                        workMattersId: workMattersIndex
                    },
                    success: function (data) {
                        addOptionToDzsx(data);
                    },
                    error: function (error) {
                        alert("Request error!" + error);
                    }
                }
            )
        })
    });
</script>
<!-- <div style="text-align:center;margin:50px 0; fonts:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器：360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下浏览器。</p>
<p>来源：<a href="http://sc.chinaz.com/" target="_blank">站长素材</a></p>
</div> -->
</body>
</html>